﻿<Window x:Class="Dialogs.WinPersonList"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="People" Height="300" Width="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="6*" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <!--note: ItemsSource="{Binding}" indicates that bind to whole list-->
        <ListBox Grid.ColumnSpan="2"  Name="lbxPersons" Margin="5"
                 ItemsSource="{Binding}"
                 IsSynchronizedWithCurrentItem="True"
                 MouseDoubleClick="lbxPersons_MouseDoubleClick">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock>
                        <TextBlock  Text="{Binding Name}"/> (age: <TextBlock Text="{Binding Age}" />)
                    </TextBlock>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Button Content="Edit" Grid.Column="1" Grid.Row="1" Margin="5" Name="btnEdit" Click="btnEdit_Click" />
    </Grid>
</Window>
